<?php
/*
 * @ https://EasyToYou.eu - IonCube v11 Decoder Online
 * @ PHP 7.2 & 7.3
 * @ Decoder version: 1.1.6
 * @ Release: 10/08/2022
 */

// Decoded file for php version 71.
namespace app\massage\model;

class CarCashType extends \app\BaseModel
{
    protected $name = "massage_service_car_cash_type";
    public function dataAdd($data)
    {
        $data["create_time"] = time();
        $res = $this->insert($data);
        return $res;
    }
    public function dataUpdate($dis, $data)
    {
        $res = $this->where($dis)->update($data);
        return $res;
    }
    public function dataList($dis, $page)
    {
        $data = $this->where($dis)->order("id desc")->paginate($page)->toArray();
        return $data;
    }
    public function dataInfo($dis)
    {
        $data = $this->where($dis)->find();
        return !empty($data) ? $data->toArray() : [];
    }
    public function getConfigList($config_id, $type)
    {
        $dis = ["config_id" => $config_id, "type" => $type];
        $list = $this->where($dis)->order("km,id desc")->select()->toArray();
        return $list;
    }
    public function updateConfigList($data, $config_id, $type, $uniacid)
    {
        $this->where(["config_id" => $config_id, "type" => $type])->delete();
        foreach ($data as $k => $v) {
            $insert[$k] = ["uniacid" => $uniacid, "config_id" => $config_id, "cash" => $v["cash"], "km" => $v["km"], "type" => $type];
        }
        $res = $this->saveAll($insert);
        return $res;
    }
}

?>